home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmStates
- Caption = "State Demographics"
- ClientHeight = 1620
- ClientLeft = 1128
- ClientTop = 1632
- ClientWidth = 4884
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 7.8
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- LinkTopic = "Form1"
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 1620
- ScaleWidth = 4884
- Begin VB.CommandButton cmdDisplay
- Caption = "Display Demographics"
- Default = -1 'True
- Height = 495
- Left = 720
- TabIndex = 1
- Top = 240
- Width = 3375
- End
- Begin VB.PictureBox picDensity
- Height = 495
- Left = 120
- ScaleHeight = 444
- ScaleWidth = 4524
- TabIndex = 0
- Top = 960
- Width = 4575
- End
- Attribute VB_Name = "frmStates"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub cmdDisplay_Click()
- 'Calculate the population densities of states
- picDensity.Cls
- Call CalculateDensity("Hawaii", 1184000, 6471)
- Call CalculateDensity("Alaska", 607000, 591000)
- End Sub
- Private Sub CalculateDensity(state As String, pop As Single, area As Single)
- Dim rawDensity As Single, density As Single
- 'The density (number of people per square mile)
- 'will be displayed rounded to a whole number
- rawDensity = pop / area
- density = Round(rawDensity) 'round to whole number
- picDensity.Print "The density of "; state; " is"; density;
- picDensity.Print "people per square mile."
- End Sub
-